package com.kaoqin.util;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.List;

import org.springframework.util.StringUtils;

public class SysUtils {
	/**
	 * @Title: isNotList
	 * @Description: 判断List集合是否为空
	 * @param list
	 * @return: boolean
	 * @date: 2017-7-25 下午5:37:13
	 * @author: Janus
	 */
	public static boolean isNotList(List list) {
		return list != null && list.size() > 0;
	}
	/**
	 * @Title: encodingFileName
	 * @Description: 将字符转转换为
	 * @param fileName
	 * @return: String
	 * @date: 2017-7-25 下午5:37:30
	 * @author: Janus
	 */
	public static String encodingFileName(String fileName) {
		String returnFileName = "";
		try {
			returnFileName = URLEncoder.encode(fileName, "UTF-8");
			returnFileName = StringUtils.replace(returnFileName, "+", "%20");
			if (returnFileName.length() > 150) {
				returnFileName = new String(fileName.getBytes("GB2312"), "ISO8859-1");
				returnFileName = StringUtils.replace(returnFileName, " ", "%20");
			}
		} catch (UnsupportedEncodingException e) {
			e.printStackTrace();
		}
		return returnFileName;
	}
}
